<script>
import i18n from '@/locale'

export default {
  name: 'Dyntimerange',
  model: {
    prop: 'value',
    event: 'input'
  },
  props: {
    value: {
      type: [String, Date],
      default: ''
    },
    item: {
      type: Object,
      default: () => ({})
    }
  },
  methods: {
    handlerSelect(value) {
      this.$emit('input', value)
      // 执行事件对象
      this.item.event && this.item.event(value)
    }
  },
  render: function(h) {
    return (
      <el-time-picker
        // default-value={this.item.defaultValue}
        value={this.value}
        on-input={this.handlerSelect.bind(this)}
        disabled={this.item.disabled}
        placeholder={`${i18n.t('pleaseSelect')}${this.item.label}`}
        format={'HH:mm'}
        value-format={'HH:mm'}
      >
      </el-time-picker>
    )
  }
}
</script>
